<template>
    <div id="main">
        <div class="content clear">
            <div class="account-wrapper">
                <div class="account-sidebar">
                    <div class="avatar gray-box clear">
                        <div class="js-account-sidebar-info">
                            <img :src="avatar">
                        </div>
                        <div class="box-inner">
                            <ul class="account-nav"> 
                                <li >
                                    <router-link to="/account/order">我的订单</router-link>
                                </li> 
                                <li class="">
                                    <router-link to="/account/address">收货地址</router-link>
                                </li> 
                                <li class="">
                                    <router-link to="/account/setting">个人设置</router-link>
                                </li> 
                            </ul>
                        </div>
                    </div>
                </div>
                <div class="account-content">
                    <!-- 此处展示个人中心的子组件 -->
                    <router-view></router-view>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    import {mapState} from 'vuex'
    export default {
        computed: {
            ...mapState({
                avatar:state=>{
                    let photo = 'http://static.smartisanos.cn/account/asset/img/default-user-avatar.png'
                    let {avatar} = state.my.userInfo
                    if(avatar){
                        photo = 'http://localhost:3003'+avatar
                    }
                    return photo
                }
            })
        },
    }
</script>

<style src="../../assets/css/account.css" scoped></style>
<style scoped>
.router-link-exact-active.router-link-active{
    background: #9CAEE9;
    color: #fff !important;
}
</style>
